import java.util.ArrayList;
import java.util.List;

public class FruitObservable {
    private List<FruitObserver> observers = new ArrayList<>();

    public void attach(FruitObserver observer) {
        observers.add(observer);
    }

    public void detach(FruitObserver observer) {
        observers.remove(observer);
    }

    public void notifyObservers(Fruit fruit) {
        for (FruitObserver observer : observers) {
            observer.update(fruit);
        }
    }
}
